package com.carepad.util;

import com.carepad.entity.mapper.RecordItemState;

public class ItemTransformer {

	private String itemType;
	private String itemGroupName;
	private RecordItemState recordItemState;

	private static final String DELIMITER = ",";

	public ItemTransformer(String itemType, String itemGroupName, String items,
			String selection) {

		this.itemType = itemType;
		this.itemGroupName = itemGroupName;
		RecordItemState item = new RecordItemState();
		
		if (items != null) {
			item.setItemList(items.split(DELIMITER));
		}

		if (selection != null) {
			selection = selection.replaceAll("\\s+", "");
			item.setSelectedList(selection.split(DELIMITER));
			
		}

		this.recordItemState = item;
		
	}

	public String getItemType() {
		return itemType;
	}

	public void setItemType(String itemType) {
		this.itemType = itemType;
	}

	public String getItemGroupName() {
		return itemGroupName;
	}

	public void setItemGroupName(String itemGroupName) {
		this.itemGroupName = itemGroupName;
	}

	public RecordItemState getRecordItemState() {
		return recordItemState;
	}

	public void setRecordItemState(RecordItemState recordItemState) {
		this.recordItemState = recordItemState;
	}

}
